#!/usr/bin/env python
# coding: utf-8

import os
from django.http import HttpResponse

def test_api(request, **kwargs):
    if request.method == 'GET':
        if kwargs.get('api_type', None) == 'sms':
            s = u" ".join([u"{0}={1};".format(key, value) for key, value in request.GET.iteritems()])
            path = os.path.dirname(os.path.abspath(__file__))
            log_path = os.path.join(path, 'api.log')

            f = open(log_path, 'a')
            f.write(s.encode('utf-8') + "\n")
            f.close()
            return HttpResponse(s)
    return HttpResponse("No")

